#ifndef THREADSOCKET_H
#define THREADSOCKET_H

#include <QThread>
#include <QTcpSocket>

class threadSocket : public QThread
{
public:
    explicit threadSocket(QObject *parent = nullptr);

    // 析构函数
    ~threadSocket() {
        // 清理操作
        // 关闭连接
        socket->disconnectFromHost();
        socket->waitForDisconnected();

        delete socket;
    }

    void setSocketConfigure(const QString &kanbanIP, const int &port = 8023);
    void setContextString(const QString &str);

protected:
    void run() override;

private:
    QString m_kanbanIP;     // 看板IP
    int m_port;             // 端口
    QString m_string;       // 传入字符串

    // 创建一个QTcpSocket对象
    QTcpSocket *socket = NULL;
};

#endif // THREADSOCKET_H
